var MenuMatic=new Class({Implements:Options,options:{id:&quot;nav&quot;,subMenusContainerId:&quot;subMenusContainer&quot;,effect:&quot;slide &amp; fade&quot;,duration:600,physics:Fx.Transitions.Pow.easeOut,hideDelay:1000,stretchMainMenu:false,matchWidthMode:false,orientation:&quot;horizontal&quot;,direction:{x:&quot;right&quot;,y:&quot;down&quot;},tweakInitial:{x:0,y:0},tweakSubsequent:{x:0,y:0},center:false,opacity:95,mmbFocusedClassName:null,mmbClassName:null,killDivider:null,fixHasLayoutBug:false,onHideAllSubMenusNow_begin:(function(){}),onHideAllSubMenusNow_complete:(function(){}),onInit_begin:(function(){}),onInit_complete:(function(){})},hideAllMenusTimeout:null,allSubMenus:[],subMenuZindex:1,initialize:function(d){this.setOptions(d);
this.options.onInit_begin();
if(this.options.opacity&gt;99){this.options.opacity=99.9
}this.options.opacity=this.options.opacity/100;
Element.implement({getId:function(){if(!this.id){var e=this.get(&quot;tag&quot;)+&quot;-&quot;+$time();
while($(e)){e=this.get(&quot;tag&quot;)+&quot;-&quot;+$time()
}this.id=e
}return this.id
}});
this.options.direction.x=this.options.direction.x.toLowerCase();
this.options.direction.y=this.options.direction.y.toLowerCase();
if(this.options.direction.x===&quot;right&quot;){this.options.direction.xInverse=&quot;left&quot;
}else{if(this.options.direction.x===&quot;left&quot;){this.options.direction.xInverse=&quot;right&quot;
}}if(this.options.direction.y===&quot;up&quot;){this.options.direction.yInverse=&quot;down&quot;
}else{if(this.options.direction.y===&quot;down&quot;){this.options.direction.yInverse=&quot;up&quot;
}}var a=$(this.options.id).getElements(&quot;a&quot;);
a.each(function(e,f){e.store(&quot;parentLinks&quot;,e.getParent().getParents(&quot;li&quot;).getFirst(&quot;a&quot;));
e.store(&quot;parentLinks&quot;,e.retrieve(&quot;parentLinks&quot;).erase(e.retrieve(&quot;parentLinks&quot;).getFirst()));
e.store(&quot;childMenu&quot;,e.getNext(&quot;ul&quot;)||e.getNext(&quot;ol&quot;));
theSubMenuType=&quot;subsequent&quot;;
if($(e.getParent(&quot;ul&quot;)||e.getParent(&quot;ol&quot;)).id===this.options.id){theSubMenuType=&quot;initial&quot;
}e.store(&quot;subMenuType&quot;,theSubMenuType);
if(theSubMenuType===&quot;initial&quot;&amp;&amp;$(e.getNext(&quot;ul&quot;)||e.getNext(&quot;ol&quot;))){e.addClass(&quot;mainMenuParentBtn&quot;)
}else{if($(e.getNext(&quot;ul&quot;)||e.getNext(&quot;ol&quot;))){e.addClass(&quot;subMenuParentBtn&quot;)
}}}.bind(this));
var b=new Element(&quot;div&quot;,{id:this.options.subMenusContainerId}).inject($(document.body),&quot;bottom&quot;);
$(this.options.id).getElements(&quot;ul, ol&quot;).each(function(e,f){new Element(&quot;div&quot;,{&quot;class&quot;:&quot;smOW&quot;}).inject(b).grab(e)
}.bind(this));
b.getElements(&quot;a&quot;).set(&quot;tabindex&quot;,&quot;-1&quot;);
a.each(function(e,g){if(!e.retrieve(&quot;childMenu&quot;)){return
}e.store(&quot;childMenu&quot;,e.retrieve(&quot;childMenu&quot;).getParent(&quot;div&quot;));
this.allSubMenus.include(e.retrieve(&quot;childMenu&quot;));
e.store(&quot;parentSubMenus&quot;,e.retrieve(&quot;parentLinks&quot;).retrieve(&quot;childMenu&quot;));
var f=new MenuMaticSubMenu(this.options,this,e)
}.bind(this));
var c=$(this.options.id).getElements(&quot;a&quot;).filter(function(e,f){return !e.retrieve(&quot;childMenu&quot;)
});
c.each(function(e,f){e.addEvents({mouseenter:function(g){this.hideAllSubMenusNow();
if(this.options.mmbClassName&amp;&amp;this.options.mmbFocusedClassName){$(e).retrieve(&quot;btnMorph&quot;,new Fx.Morph(e,{duration:(this.options.duration/2),transition:this.options.physics,link:&quot;cancel&quot;})).start(this.options.mmbFocusedClassName)
}}.bind(this),focus:function(g){this.hideAllSubMenusNow();
if(this.options.mmbClassName&amp;&amp;this.options.mmbFocusedClassName){$(e).retrieve(&quot;btnMorph&quot;,new Fx.Morph(e,{duration:(this.options.duration/2),transition:this.options.physics,link:&quot;cancel&quot;})).start(this.options.mmbFocusedClassName)
}}.bind(this),mouseleave:function(g){if(this.options.mmbClassName&amp;&amp;this.options.mmbFocusedClassName){$(e).retrieve(&quot;btnMorph&quot;,new Fx.Morph(e,{duration:(this.options.duration*5),transition:this.options.physics,link:&quot;cancel&quot;})).start(this.options.mmbClassName)
}}.bind(this),blur:function(g){if(this.options.mmbClassName&amp;&amp;this.options.mmbFocusedClassName){$(e).retrieve(&quot;btnMorph&quot;,new Fx.Morph(e,{duration:(this.options.duration*5),transition:this.options.physics,link:&quot;cancel&quot;})).start(this.options.mmbClassName)
}}.bind(this),keydown:function(g){var h=new Event(g);
if(g.key===&quot;up&quot;||g.key===&quot;down&quot;||g.key===&quot;left&quot;||g.key===&quot;right&quot;){g.stop()
}if(g.key===&quot;left&quot;&amp;&amp;this.options.orientation===&quot;horizontal&quot;||g.key===&quot;up&quot;&amp;&amp;this.options.orientation===&quot;vertical&quot;){if(e.getParent(&quot;li&quot;).getPrevious(&quot;li&quot;)){e.getParent(&quot;li&quot;).getPrevious(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}else{e.getParent(&quot;li&quot;).getParent().getLast(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}}else{if(g.key===&quot;right&quot;&amp;&amp;this.options.orientation===&quot;horizontal&quot;||g.key===&quot;down&quot;&amp;&amp;this.options.orientation===&quot;vertical&quot;){if(e.getParent(&quot;li&quot;).getNext(&quot;li&quot;)){e.getParent(&quot;li&quot;).getNext(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}else{e.getParent(&quot;li&quot;).getParent().getFirst(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}}}}.bind(this)})
},this);
this.stretch();
this.killDivider();
this.center();
this.fixHasLayoutBug();
this.options.onInit_complete()
},fixHasLayoutBug:function(){if(Browser.Engine.trident&amp;&amp;this.options.fixHasLayoutBug){$(this.options.id).getParents().setStyle(&quot;zoom&quot;,1);
$(this.options.id).setStyle(&quot;zoom&quot;,1);
$(this.options.id).getChildren().setStyle(&quot;zoom&quot;,1);
$(this.options.subMenusContainerId).setStyle(&quot;zoom&quot;,1);
$(this.options.subMenusContainerId).getChildren().setStyle(&quot;zoom&quot;,1)
}},center:function(){if(!this.options.center){return
}$(this.options.id).setStyles({left:&quot;50%&quot;,&quot;margin-left&quot;:-($(this.options.id).getSize().x/2)})
},stretch:function(){if(this.options.stretchMainMenu&amp;&amp;this.options.orientation===&quot;horizontal&quot;){var c=parseFloat($(this.options.id).getCoordinates().width);
var b=0;
var d=$(this.options.id).getElements(&quot;a&quot;);
d.setStyles({&quot;padding-left&quot;:0,&quot;padding-right&quot;:0});
d.each(function(e,f){b+=e.getSize().x
}.bind(this));
if(c&lt;b){return
}var a=(c-b)/d.length;
d.each(function(e,f){e.setStyle(&quot;width&quot;,e.getSize().x+a)
}.bind(this));
d.getLast().setStyle(&quot;width&quot;,d.getLast().getSize().x-1)
}},killDivider:function(){if(this.options.killDivider&amp;&amp;this.options.killDivider.toLowerCase()===&quot;first&quot;){$($(this.options.id).getElements(&quot;li&quot;)[0]).setStyles({background:&quot;none&quot;})
}else{if(this.options.killDivider&amp;&amp;this.options.killDivider.toLowerCase()===&quot;last&quot;){$($(this.options.id).getElements(&quot;li&quot;).getLast()).setStyles({background:&quot;none&quot;})
}}},hideAllSubMenusNow:function(){this.options.onHideAllSubMenusNow_begin();
$clear(this.hideAllMenusTimeout);
$$(this.allSubMenus).fireEvent(&quot;hide&quot;);
this.options.onHideAllSubMenusNow_complete()
}});
var MenuMaticSubMenu=new Class({Implements:Options,Extends:MenuMatic,options:{onSubMenuInit_begin:(function(a){}),onSubMenuInit_complete:(function(a){}),onMatchWidth_begin:(function(a){}),onMatchWidth_complete:(function(a){}),onHideSubMenu_begin:(function(a){}),onHideSubMenu_complete:(function(a){}),onHideOtherSubMenus_begin:(function(a){}),onHideOtherSubMenus_complete:(function(a){}),onHideAllSubMenus_begin:(function(a){}),onHideAllSubMenus_complete:(function(a){}),onPositionSubMenu_begin:(function(a){}),onPositionSubMenu_complete:(function(a){}),onShowSubMenu_begin:(function(a){}),onShowSubMenu_complete:(function(a){})},root:null,btn:null,hidden:true,myEffect:null,initialize:function(d,a,c){this.setOptions(d);
this.root=a;
this.btn=c;
this.childMenu=this.btn.retrieve(&quot;childMenu&quot;);
this.subMenuType=this.btn.retrieve(&quot;subMenuType&quot;);
this.childMenu=this.btn.retrieve(&quot;childMenu&quot;);
this.parentSubMenus=$$(this.btn.retrieve(&quot;parentSubMenus&quot;));
this.parentLinks=$$(this.btn.retrieve(&quot;parentLinks&quot;));
this.parentSubMenu=$(this.parentSubMenus[0]);
if(this.parentSubMenu){this.parentSubMenu=this.parentSubMenu.retrieve(&quot;class&quot;)
}this.childMenu.store(&quot;class&quot;,this);
this.btn.store(&quot;class&quot;,this);
this.childMenu.store(&quot;status&quot;,&quot;closed&quot;);
this.options.onSubMenuInit_begin(this);
this.childMenu.addEvent(&quot;hide&quot;,function(){this.hideSubMenu()
}.bind(this));
this.childMenu.addEvent(&quot;show&quot;,function(){this.showSubMenu()
}.bind(this));
if(this.options.effect){this.myEffect=new Fx.Morph($(this.childMenu).getFirst(),{duration:this.options.duration,transition:this.options.physics,link:&quot;cancel&quot;})
}if(this.options.effect===&quot;slide&quot;||this.options.effect===&quot;slide &amp; fade&quot;){if(this.subMenuType==&quot;initial&quot;&amp;&amp;this.options.orientation===&quot;horizontal&quot;){this.childMenu.getFirst().setStyle(&quot;margin-top&quot;,&quot;0&quot;)
}else{this.childMenu.getFirst().setStyle(&quot;margin-left&quot;,&quot;0&quot;)
}}else{if(this.options.effect===&quot;fade&quot;||this.options.effect===&quot;slide &amp; fade&quot;){this.childMenu.getFirst().setStyle(&quot;opacity&quot;,0)
}}if(this.options.effect!=&quot;fade&quot;&amp;&amp;this.options.effect!=&quot;slide &amp; fade&quot;){this.childMenu.getFirst().setStyle(&quot;opacity&quot;,this.options.opacity)
}var b=$(this.childMenu).getElements(&quot;a&quot;).filter(function(e,f){return !e.retrieve(&quot;childMenu&quot;)
});
b.each(function(e,f){$(e).addClass(&quot;subMenuBtn&quot;);
e.addEvents({mouseenter:function(g){this.childMenu.fireEvent(&quot;show&quot;);
this.cancellHideAllSubMenus();
this.hideOtherSubMenus()
}.bind(this),focus:function(g){this.childMenu.fireEvent(&quot;show&quot;);
this.cancellHideAllSubMenus();
this.hideOtherSubMenus()
}.bind(this),mouseleave:function(g){this.cancellHideAllSubMenus();
this.hideAllSubMenus()
}.bind(this),blur:function(g){this.cancellHideAllSubMenus();
this.hideAllSubMenus()
}.bind(this),keydown:function(g){var h=new Event(g);
if(g.key===&quot;up&quot;||g.key===&quot;down&quot;||g.key===&quot;left&quot;||g.key===&quot;right&quot;||g.key===&quot;tab&quot;){g.stop()
}if(g.key===&quot;up&quot;){if(e.getParent(&quot;li&quot;).getPrevious(&quot;li&quot;)){e.getParent(&quot;li&quot;).getPrevious(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}else{if(this.options.direction.y===&quot;down&quot;){this.btn.focus()
}else{if(this.options.direction.y===&quot;up&quot;){e.getParent(&quot;li&quot;).getParent().getLast(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}}}}else{if(g.key===&quot;down&quot;){if(e.getParent(&quot;li&quot;).getNext(&quot;li&quot;)){e.getParent(&quot;li&quot;).getNext(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}else{if(this.options.direction.y===&quot;down&quot;){e.getParent(&quot;li&quot;).getParent().getFirst(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}else{if(this.options.direction.y===&quot;up&quot;){this.btn.focus()
}}}}else{if(g.key===this.options.direction.xInverse){this.btn.focus()
}}}}.bind(this)})
},this);
$(this.btn).removeClass(&quot;subMenuBtn&quot;);
if(this.subMenuType==&quot;initial&quot;){this.btn.addClass(&quot;mainParentBtn&quot;)
}else{this.btn.addClass(&quot;subParentBtn&quot;)
}$(this.btn).addEvents({mouseenter:function(e){this.cancellHideAllSubMenus();
this.hideOtherSubMenus();
this.showSubMenu();
if(this.subMenuType===&quot;initial&quot;&amp;&amp;this.options.mmbClassName&amp;&amp;this.options.mmbFocusedClassName){$(this.btn).retrieve(&quot;btnMorph&quot;,new Fx.Morph($(this.btn),{duration:(this.options.duration/2),transition:this.options.physics,link:&quot;cancel&quot;})).start(this.options.mmbFocusedClassName)
}}.bind(this),focus:function(e){this.cancellHideAllSubMenus();
this.hideOtherSubMenus();
this.showSubMenu();
if(this.subMenuType===&quot;initial&quot;&amp;&amp;this.options.mmbClassName&amp;&amp;this.options.mmbFocusedClassName){$(this.btn).retrieve(&quot;btnMorph&quot;,new Fx.Morph($(this.btn),{duration:(this.options.duration/2),transition:this.options.physics,link:&quot;cancel&quot;})).start(this.options.mmbFocusedClassName)
}}.bind(this),mouseleave:function(e){this.cancellHideAllSubMenus();
this.hideAllSubMenus()
}.bind(this),blur:function(e){this.cancellHideAllSubMenus();
this.hideAllSubMenus()
}.bind(this),keydown:function(e){e=new Event(e);
if(e.key===&quot;up&quot;||e.key===&quot;down&quot;||e.key===&quot;left&quot;||e.key===&quot;right&quot;){e.stop()
}if(!this.parentSubMenu){if(this.options.orientation===&quot;horizontal&quot;&amp;&amp;e.key===this.options.direction.y||this.options.orientation===&quot;vertical&quot;&amp;&amp;e.key===this.options.direction.x){if(this.options.direction.y===&quot;down&quot;){this.childMenu.getFirst().getFirst(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}else{if(this.options.direction.y===&quot;up&quot;){this.childMenu.getFirst().getLast(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}}}else{if(this.options.orientation===&quot;horizontal&quot;&amp;&amp;e.key===&quot;left&quot;||this.options.orientation===&quot;vertical&quot;&amp;&amp;e.key===this.options.direction.yInverse){if(this.btn.getParent().getPrevious()){this.btn.getParent().getPrevious().getFirst().focus()
}else{this.btn.getParent().getParent().getLast().getFirst().focus()
}}else{if(this.options.orientation===&quot;horizontal&quot;&amp;&amp;e.key===&quot;right&quot;||this.options.orientation===&quot;vertical&quot;&amp;&amp;e.key===this.options.direction.y){if(this.btn.getParent().getNext()){this.btn.getParent().getNext().getFirst().focus()
}else{this.btn.getParent().getParent().getFirst().getFirst().focus()
}}}}}else{if(e.key===&quot;tab&quot;){e.stop()
}if(e.key===&quot;up&quot;){if(this.btn.getParent(&quot;li&quot;).getPrevious(&quot;li&quot;)){this.btn.getParent(&quot;li&quot;).getPrevious(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}else{if(this.options.direction.y===&quot;down&quot;){this.parentSubMenu.btn.focus()
}else{if(this.options.direction.y===&quot;up&quot;){this.btn.getParent(&quot;li&quot;).getParent().getLast(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}}}}else{if(e.key===&quot;down&quot;){if(this.btn.getParent(&quot;li&quot;).getNext(&quot;li&quot;)){this.btn.getParent(&quot;li&quot;).getNext(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}else{if(this.options.direction.y===&quot;down&quot;){this.btn.getParent(&quot;li&quot;).getParent().getFirst(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}else{if(this.options.direction.y===&quot;up&quot;){this.parentSubMenu.btn.focus()
}}}}else{if(e.key===this.options.direction.xInverse){this.parentSubMenu.btn.focus()
}else{if(e.key===this.options.direction.x){if(this.options.direction.y===&quot;down&quot;){this.childMenu.getFirst().getFirst(&quot;li&quot;).getFirst(&quot;a&quot;).focus()
}else{if(this.options.direction.y===&quot;up&quot;){}}}}}}}}.bind(this)});
this.options.onSubMenuInit_complete(this)
},matchWidth:function(){if(this.widthMatched||!this.options.matchWidthMode||this.subMenuType===&quot;subsequent&quot;){return
}this.options.onMatchWidth_begin(this);
var a=this.btn.getCoordinates().width;
$(this.childMenu).getElements(&quot;a&quot;).each(function(c,d){var e=parseFloat($(this.childMenu).getFirst().getStyle(&quot;border-left-width&quot;))+parseFloat($(this.childMenu).getFirst().getStyle(&quot;border-right-width&quot;));
var f=parseFloat(c.getStyle(&quot;padding-left&quot;))+parseFloat(c.getStyle(&quot;padding-right&quot;));
var b=e+f;
if(a&gt;c.getCoordinates().width){c.setStyle(&quot;width&quot;,a-b);
c.setStyle(&quot;margin-right&quot;,-e)
}}.bind(this));
this.width=this.childMenu.getFirst().getCoordinates().width;
this.widthMatched=true;
this.options.onMatchWidth_complete(this)
},hideSubMenu:function(){if(this.childMenu.retrieve(&quot;status&quot;)===&quot;closed&quot;){return
}this.options.onHideSubMenu_begin(this);
if(this.subMenuType==&quot;initial&quot;){if(this.options.mmbClassName&amp;&amp;this.options.mmbFocusedClassName){$(this.btn).retrieve(&quot;btnMorph&quot;,new Fx.Morph($(this.btn),{duration:(this.options.duration),transition:this.options.physics,link:&quot;cancel&quot;})).start(this.options.mmbClassName).chain(function(){$(this.btn).removeClass(&quot;mainMenuParentBtnFocused&quot;);
$(this.btn).addClass(&quot;mainMenuParentBtn&quot;)
}.bind(this))
}else{$(this.btn).removeClass(&quot;mainMenuParentBtnFocused&quot;);
$(this.btn).addClass(&quot;mainMenuParentBtn&quot;)
}}else{$(this.btn).removeClass(&quot;subMenuParentBtnFocused&quot;);
$(this.btn).addClass(&quot;subMenuParentBtn&quot;)
}this.childMenu.setStyle(&quot;z-index&quot;,1);
if(this.options.effect&amp;&amp;this.options.effect.toLowerCase()===&quot;slide&quot;){if(this.subMenuType==&quot;initial&quot;&amp;&amp;this.options.orientation===&quot;horizontal&quot;&amp;&amp;this.options.direction.y===&quot;down&quot;){this.myEffect.start({&quot;margin-top&quot;:-this.height}).chain(function(){this.childMenu.style.display=&quot;none&quot;
}.bind(this))
}else{if(this.subMenuType==&quot;initial&quot;&amp;&amp;this.options.orientation===&quot;horizontal&quot;&amp;&amp;this.options.direction.y===&quot;up&quot;){this.myEffect.start({&quot;margin-top&quot;:this.height}).chain(function(){this.childMenu.style.display=&quot;none&quot;
}.bind(this))
}else{if(this.options.direction.x===&quot;right&quot;){this.myEffect.start({&quot;margin-left&quot;:-this.width}).chain(function(){this.childMenu.style.display=&quot;none&quot;
}.bind(this))
}else{if(this.options.direction.x===&quot;left&quot;){this.myEffect.start({&quot;margin-left&quot;:this.width}).chain(function(){this.childMenu.style.display=&quot;none&quot;
}.bind(this))
}}}}}else{if(this.options.effect==&quot;fade&quot;){this.myEffect.start({opacity:0}).chain(function(){this.childMenu.style.display=&quot;none&quot;
}.bind(this))
}else{if(this.options.effect==&quot;slide &amp; fade&quot;){if(this.subMenuType==&quot;initial&quot;&amp;&amp;this.options.orientation===&quot;horizontal&quot;&amp;&amp;this.options.direction.y===&quot;down&quot;){this.myEffect.start({&quot;margin-top&quot;:-this.height,opacity:0}).chain(function(){this.childMenu.style.display=&quot;none&quot;
}.bind(this))
}else{if(this.subMenuType==&quot;initial&quot;&amp;&amp;this.options.orientation===&quot;horizontal&quot;&amp;&amp;this.options.direction.y===&quot;up&quot;){this.myEffect.start({&quot;margin-top&quot;:this.height,opacity:0}).chain(function(){this.childMenu.style.display=&quot;none&quot;
}.bind(this))
}else{if(this.options.direction.x===&quot;right&quot;){this.myEffect.start({&quot;margin-left&quot;:-this.width,opacity:0}).chain(function(){this.childMenu.style.display=&quot;none&quot;
}.bind(this))
}else{if(this.options.direction.x===&quot;left&quot;){this.myEffect.start({&quot;margin-left&quot;:this.width,opacity:0}).chain(function(){this.childMenu.style.display=&quot;none&quot;
}.bind(this))
}}}}}else{this.childMenu.style.display=&quot;none&quot;
}}}this.childMenu.store(&quot;status&quot;,&quot;closed&quot;);
this.options.onHideSubMenu_complete(this)
},hideOtherSubMenus:function(){this.options.onHideOtherSubMenus_begin(this);
if(!this.btn.retrieve(&quot;otherSubMenus&quot;)){this.btn.store(&quot;otherSubMenus&quot;,$$(this.root.allSubMenus.filter(function(a){return !this.btn.retrieve(&quot;parentSubMenus&quot;).contains(a)&amp;&amp;a!=this.childMenu
}.bind(this))))
}this.parentSubMenus.fireEvent(&quot;show&quot;);
this.btn.retrieve(&quot;otherSubMenus&quot;).fireEvent(&quot;hide&quot;);
this.options.onHideOtherSubMenus_complete(this)
},hideAllSubMenus:function(){this.options.onHideAllSubMenus_begin(this);
$clear(this.root.hideAllMenusTimeout);
this.root.hideAllMenusTimeout=(function(){$clear(this.hideAllMenusTimeout);
$$(this.root.allSubMenus).fireEvent(&quot;hide&quot;)
}).bind(this).delay(this.options.hideDelay);
this.options.onHideAllSubMenus_complete(this)
},cancellHideAllSubMenus:function(){$clear(this.root.hideAllMenusTimeout)
},showSubMenu:function(a){if(this.childMenu.retrieve(&quot;status&quot;)===&quot;open&quot;){return
}this.options.onShowSubMenu_begin(this);
if(this.subMenuType==&quot;initial&quot;){$(this.btn).removeClass(&quot;mainMenuParentBtn&quot;);
$(this.btn).addClass(&quot;mainMenuParentBtnFocused&quot;)
}else{$(this.btn).removeClass(&quot;subMenuParentBtn&quot;);
$(this.btn).addClass(&quot;subMenuParentBtnFocused&quot;)
}this.root.subMenuZindex++;
this.childMenu.setStyles({display:&quot;block&quot;,visibility:&quot;hidden&quot;,&quot;z-index&quot;:this.root.subMenuZindex});
if(!this.width||!this.height){this.width=this.childMenu.getFirst().getCoordinates().width;
this.height=this.childMenu.getFirst().getCoordinates().height;
this.childMenu.setStyle(&quot;height&quot;,this.height,&quot;border&quot;);
if(this.options.effect===&quot;slide&quot;||this.options.effect===&quot;slide &amp; fade&quot;){if(this.subMenuType==&quot;initial&quot;&amp;&amp;this.options.orientation===&quot;horizontal&quot;){this.childMenu.getFirst().setStyle(&quot;margin-top&quot;,&quot;0&quot;);
if(this.options.direction.y===&quot;down&quot;){this.myEffect.set({&quot;margin-top&quot;:-this.height})
}else{if(this.options.direction.y===&quot;up&quot;){this.myEffect.set({&quot;margin-top&quot;:this.height})
}}}else{if(this.options.direction.x===&quot;left&quot;){this.myEffect.set({&quot;margin-left&quot;:this.width})
}else{this.myEffect.set({&quot;margin-left&quot;:-this.width})
}}}}this.matchWidth();
this.positionSubMenu();
if(this.options.effect===&quot;slide&quot;){this.childMenu.setStyles({display:&quot;block&quot;,visibility:&quot;visible&quot;});
if(this.subMenuType===&quot;initial&quot;&amp;&amp;this.options.orientation===&quot;horizontal&quot;){if(a){this.myEffect.set({&quot;margin-top&quot;:0}).chain(function(){this.showSubMenuComplete()
}.bind(this))
}else{this.myEffect.start({&quot;margin-top&quot;:0}).chain(function(){this.showSubMenuComplete()
}.bind(this))
}}else{if(a){this.myEffect.set({&quot;margin-left&quot;:0}).chain(function(){this.showSubMenuComplete()
}.bind(this))
}else{this.myEffect.start({&quot;margin-left&quot;:0}).chain(function(){this.showSubMenuComplete()
}.bind(this))
}}}else{if(this.options.effect===&quot;fade&quot;){if(a){this.myEffect.set({opacity:this.options.opacity}).chain(function(){this.showSubMenuComplete()
}.bind(this))
}else{this.myEffect.start({opacity:this.options.opacity}).chain(function(){this.showSubMenuComplete()
}.bind(this))
}}else{if(this.options.effect==&quot;slide &amp; fade&quot;){this.childMenu.setStyles({display:&quot;block&quot;,visibility:&quot;visible&quot;});
this.childMenu.getFirst().setStyles({left:0});
if(this.subMenuType===&quot;initial&quot;&amp;&amp;this.options.orientation===&quot;horizontal&quot;){if(a){this.myEffect.set({&quot;margin-top&quot;:0,opacity:this.options.opacity}).chain(function(){this.showSubMenuComplete()
}.bind(this))
}else{this.myEffect.start({&quot;margin-top&quot;:0,opacity:this.options.opacity}).chain(function(){this.showSubMenuComplete()
}.bind(this))
}}else{if(a){if(this.options.direction.x===&quot;right&quot;){this.myEffect.set({&quot;margin-left&quot;:0,opacity:this.options.opacity}).chain(function(){this.showSubMenuComplete()
}.bind(this))
}else{if(this.options.direction.x===&quot;left&quot;){this.myEffect.set({&quot;margin-left&quot;:0,opacity:this.options.opacity}).chain(function(){this.showSubMenuComplete()
}.bind(this))
}}}else{if(this.options.direction.x===&quot;right&quot;){this.myEffect.set({&quot;margin-left&quot;:-this.width,opacity:this.options.opacity});
this.myEffect.start({&quot;margin-left&quot;:0,opacity:this.options.opacity}).chain(function(){this.showSubMenuComplete()
}.bind(this))
}else{if(this.options.direction.x===&quot;left&quot;){this.myEffect.start({&quot;margin-left&quot;:0,opacity:this.options.opacity}).chain(function(){this.showSubMenuComplete()
}.bind(this))
}}}}}else{this.childMenu.setStyles({display:&quot;block&quot;,visibility:&quot;visible&quot;}).chain(function(){this.showSubMenuComplete(this)
}.bind(this))
}}}this.childMenu.store(&quot;status&quot;,&quot;open&quot;)
},showSubMenuComplete:function(){this.options.onShowSubMenu_complete(this)
},positionSubMenu:function(){this.options.onPositionSubMenu_begin(this);
this.childMenu.setStyle(&quot;width&quot;,this.width);
this.childMenu.getFirst().setStyle(&quot;width&quot;,this.width);
if(this.subMenuType===&quot;subsequent&quot;){if(this.parentSubMenu&amp;&amp;this.options.direction.x!=this.parentSubMenu.options.direction.x){if(this.parentSubMenu.options.direction.x===&quot;left&quot;&amp;&amp;this.options.effect&amp;&amp;this.options.effect.contains(&quot;slide&quot;)){this.myEffect.set({&quot;margin-left&quot;:this.width})
}}this.options.direction.x=this.parentSubMenu.options.direction.x;
this.options.direction.xInverse=this.parentSubMenu.options.direction.xInverse;
this.options.direction.y=this.parentSubMenu.options.direction.y;
this.options.direction.yInverse=this.parentSubMenu.options.direction.yInverse
}var c;
var a;
if(this.subMenuType==&quot;initial&quot;){if(this.options.direction.y===&quot;up&quot;){if(this.options.orientation===&quot;vertical&quot;){c=this.btn.getCoordinates().bottom-this.height+this.options.tweakInitial.y
}else{c=this.btn.getCoordinates().top-this.height+this.options.tweakInitial.y
}this.childMenu.style.top=c+&quot;px&quot;
}else{if(this.options.orientation==&quot;horizontal&quot;){this.childMenu.style.top=this.btn.getCoordinates().bottom+this.options.tweakInitial.y+&quot;px&quot;
}else{if(this.options.orientation==&quot;vertical&quot;){c=this.btn.getPosition().y+this.options.tweakInitial.y;
if((c+this.childMenu.getSize().y)&gt;=$(document.body).getScrollSize().y){a=(c+this.childMenu.getSize().y)-$(document.body).getScrollSize().y;
c=c-a-20
}this.childMenu.style.top=c+&quot;px&quot;
}}}if(this.options.orientation==&quot;horizontal&quot;){this.childMenu.style.left=this.btn.getPosition().x+this.options.tweakInitial.x+&quot;px&quot;
}else{if(this.options.direction.x==&quot;left&quot;){this.childMenu.style.left=this.btn.getPosition().x-this.childMenu.getCoordinates().width+this.options.tweakInitial.x+&quot;px&quot;
}else{if(this.options.direction.x==&quot;right&quot;){this.childMenu.style.left=this.btn.getCoordinates().right+this.options.tweakInitial.x+&quot;px&quot;
}}}}else{if(this.subMenuType==&quot;subsequent&quot;){if(this.options.direction.y===&quot;down&quot;){if((this.btn.getCoordinates().top+this.options.tweakSubsequent.y+this.childMenu.getSize().y)&gt;=$(document.body).getScrollSize().y){a=(this.btn.getCoordinates().top+this.options.tweakSubsequent.y+this.childMenu.getSize().y)-$(document.body).getScrollSize().y;
this.childMenu.style.top=(this.btn.getCoordinates().top+this.options.tweakSubsequent.y)-a-20+&quot;px&quot;
}else{this.childMenu.style.top=this.btn.getCoordinates().top+this.options.tweakSubsequent.y+&quot;px&quot;
}}else{if(this.options.direction.y===&quot;up&quot;){if((this.btn.getCoordinates().bottom-this.height+this.options.tweakSubsequent.y)&lt;1){this.options.direction.y=&quot;down&quot;;
this.options.direction.yInverse=&quot;up&quot;;
this.childMenu.style.top=this.btn.getCoordinates().top+this.options.tweakSubsequent.y+&quot;px&quot;
}else{this.childMenu.style.top=this.btn.getCoordinates().bottom-this.height+this.options.tweakSubsequent.y+&quot;px&quot;
}}}if(this.options.direction.x==&quot;left&quot;){this.childMenu.style.left=this.btn.getCoordinates().left-this.childMenu.getCoordinates().width+this.options.tweakSubsequent.x+&quot;px&quot;;
if(this.childMenu.getPosition().x&lt;0){this.options.direction.x=&quot;right&quot;;
this.options.direction.xInverse=&quot;left&quot;;
this.childMenu.style.left=this.btn.getPosition().x+this.btn.getCoordinates().width+this.options.tweakSubsequent.x+&quot;px&quot;;
if(this.options.effect===&quot;slide&quot;||this.options.effect===&quot;slide &amp; fade&quot;){this.myEffect.set({&quot;margin-left&quot;:-this.width,opacity:this.options.opacity})
}}}else{if(this.options.direction.x==&quot;right&quot;){this.childMenu.style.left=this.btn.getCoordinates().right+this.options.tweakSubsequent.x+&quot;px&quot;;
var b=this.childMenu.getCoordinates().right;
var d=document.getCoordinates().width+window.getScroll().x;
if(b&gt;d){this.options.direction.x=&quot;left&quot;;
this.options.direction.xInverse=&quot;right&quot;;
this.childMenu.style.left=this.btn.getCoordinates().left-this.childMenu.getCoordinates().width+this.options.tweakSubsequent.x+&quot;px&quot;;
if(this.options.effect===&quot;slide&quot;||this.options.effect===&quot;slide &amp; fade&quot;){this.myEffect.set({&quot;margin-left&quot;:this.width,opacity:this.options.opacity})
}}}}}}this.options.onPositionSubMenu_complete(this)
}});
